package com.nts.visionworks.business.contents.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * ContentsDelegatedThumbnail generated by hbm2java
 */
@Entity
@Table(name = "contents_delegated_thumbnail", catalog = "visionworks")
public class ContentsDelegatedThumbnail implements java.io.Serializable
{

	private long contentsId;
	private ContentsMediaThumbnail contentsMediaThumbnail;
	private Contents contents;

	public ContentsDelegatedThumbnail()
	{
	}

	public ContentsDelegatedThumbnail(
			ContentsMediaThumbnail contentsMediaThumbnail, Contents contents)
	{
		this.contentsMediaThumbnail = contentsMediaThumbnail;
		this.contents = contents;
	}

	@GenericGenerator(name = "generator", strategy = "foreign", parameters = @Parameter(name = "property", value = "contents"))
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ContentsId", unique = true, nullable = false)
	public long getContentsId()
	{
		return this.contentsId;
	}

	public void setContentsId(long contentsId)
	{
		this.contentsId = contentsId;
	}

	@EntityIdNotNull(message = "validation.contents.contentsDelegatedThumbnail.contentsMediaThumbnail.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns(
	{
			@JoinColumn(name = "ThumbnailId", referencedColumnName = "ThumbnailId", nullable = false),
			@JoinColumn(name = "MediaId", referencedColumnName = "MediaId", nullable = false) })
	public ContentsMediaThumbnail getContentsMediaThumbnail()
	{
		return this.contentsMediaThumbnail;
	}

	public void setContentsMediaThumbnail(
			ContentsMediaThumbnail contentsMediaThumbnail)
	{
		this.contentsMediaThumbnail = contentsMediaThumbnail;
	}

	@EntityIdNotNull(message = "validation.contents.contentsDelegatedThumbnail.contents.notNull")
	@OneToOne(fetch = FetchType.LAZY)
	@PrimaryKeyJoinColumn
	public Contents getContents()
	{
		return this.contents;
	}

	public void setContents(Contents contents)
	{
		this.contents = contents;
	}

}
